#ifndef AUXILIAR_H_
#define AUXILIAR_H_

#include "includes.h"

const double pi = 3.14159265359;

double strToDouble(string &str);

int strToInteger(string &str);

const char* getSubString(string &str);

void makeVector(const double *A, const double *B, double *v);

double* getIdentityMatrix(const int &dim);

void replaceAllOccurencesOnString(string &, string::size_type, string, string);

const double qsi = 1e-10; // qsi is used to avoid division by zero

void printSimulationHeader();

enum LOG_FILES {OPENLG, UPDATELG, CLOSELG};

void LogFiles(LOG_FILES ,double t1=.0, double t2=.0, double timeStep=.0,
		double accSimTime=.0, string path="",bool hasRestart=false,
		int last_step=0, double CPU_time=.0);

void failOpeningFile(string, int, const char *);
void convertSecToTime(double t, double *h, double *m, double *s);
void STOP();
int printMatrixToFile(Mat&,const char*);
int printVectorToFile(Vec&,const char*);
double dot(const double *u, const double *v, int dim);
double norm_L2(const double *p, int dim);

double sum(double* val, int size);

void PrintForDebugging(const char*);

int P_size();
int P_pid();

#endif /*AUXILIAR_H_*/
